﻿@model AutomatedTestDataManagement.Models.HTMLField

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>HTMLField</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.FieldName, "Field Name")
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.FieldName)
            @Html.ValidationMessageFor(model => model.FieldName)
            @Html.HiddenFor(model => model.FieldID)
            @if (ViewBag.PageID != null)
            {
                <input type="hidden" name="PageID" id="PageID" value="@ViewBag.PageID" />
            }
            @if (ViewBag.SiteID != null)
            {
                <input type="hidden" name="SiteID" id="SiteID" value="@ViewBag.SiteID" />
            }
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.FieldTypeID, "Field Type")
        </div>
        <div class="editor-field">
            @Html.DropDownList("FieldTypeID", String.Empty)
            @Html.ValidationMessageFor(model => model.FieldTypeID)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @if(ViewBag.PageID != null)
    {
        if(ViewBag.SiteID != null)
        {
            @Html.ActionLink("Return to Page", "Edit", "Page", new { id = ViewBag.PageID, siteID = ViewBag.SiteID }, null)
        }
        else
        {
            @Html.ActionLink("Return to Page", "Edit", "Page", new { id = ViewBag.PageID }, null)
        }
    }
    <div>
        @Html.Partial("_NavigationManagementNav")
    </div>

</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
